/*
 * MCAL_SPI.h
 *
 *  Created on: Oct 16, 2025
 *      Author: ADMIN
 */

#ifndef BSW_MCAL_INC_MCAL_SPI_H_
#define BSW_MCAL_INC_MCAL_SPI_H_

/***********************************************************************************
 ********************************************************************************
 *--------------------------------------------------------------------------
 *                            FILE DESCRIPTION
 *--------------------------------------------------------------------------
 *
 *    File Name    :     MCAL_SPI.h
 *    File Module  :     BSW_MCAL
 *    File Description:  This file is used to define function about SPI messeage receive
 *                       and send and diagnose
 *
 *
 ********************************************************************************
 ***********************************************************************************/
#include "All_In_One.h"

typedef struct SPI_ID_Type SPI_ID_Type;
struct SPI_ID_Type{
    /* SW information */
    SPI_HandleTypeDef* spiHandle;

    /* Send configure information */
    uint8 SendByteArr;
    uint8* SendDateIndex;
    uint16 SendDateLen;

    /* Receive configure information */
    uint8 ReceiveByteArr;
    uint16 ReceiveDateLen;
    uint16 ReceiveDateCnt;
    uint8* ReceiveDateIndex;

    /* Function Index */
    Std_ReturnType (*SPISendByte_Func)    (struct  SPI_ID_Type* spi_num);
    Std_ReturnType (*SPISendDate_Func)    (struct  SPI_ID_Type* spi_num);
    Std_ReturnType (*SPIReceiveByte_Func) (struct SPI_ID_Type* spi_num);
    Std_ReturnType (*SPIReceiveDate_Func) (struct SPI_ID_Type* spi_num);    
};

Std_ReturnType MCAL_SPI_Init(void);
Std_ReturnType MCAL_SPI_DeInit(void);
Std_ReturnType SPI_SendByteDate(SPI_ID_Type* spi_num);
Std_ReturnType SPI_SendDate(SPI_ID_Type* spi_num);
Std_ReturnType SPI_ReceiveByteDate(SPI_ID_Type* spi_num);
Std_ReturnType SPI_ReceiveDate(SPI_ID_Type* spi_num);

void SPI_Creat(SPI_ID_Type* spi_num, SPI_HandleTypeDef* spiHandle);

/* Be defined GLOABAL UART_ID */
extern SPI_ID_Type SPI_ID_0x01;
#define Flash_SPI_Type  SPI_ID_0x01




#endif /* BSW_MCAL_INC_MCAL_SPI_H_ */
